package com.study.ordercenter.controller;

import com.study.ordercenter.entity.OrderEntity;
import com.study.ordercenter.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
public class OrderController {

    @Autowired
    private OrderService orderService;

    @RequestMapping(value = "/order/info/{id}")
    public OrderEntity getOrderInfo(@PathVariable Integer id ) {
        OrderEntity orderEntity = orderService.orderInfo(id);
        return orderEntity;
    }

    @RequestMapping(value = "/order/list")
    public List<OrderEntity> getOrderList() {
        List<OrderEntity> orderList = orderService.orderList();
        return orderList;
    }

}
